<template>
  <div>
      <div class="children">
           <h1>子组件</h1>
           <button @click="addmychildren">我是子组件按钮1</button><br>
           <span v-text="count"></span><br>
           <button @click="minimychildren">我是子组件按钮2</button>
           <Grandson></Grandson>
      </div> 
  </div>
</template>

<script>
import Grandson from'./Grandson'
export default {
    props:['count'],
    components:{
        Grandson
    },
  data: function() {
    return {}
  },
  methods: {
       addmychildren(){
           //add是自定义的事件
           this.$emit('add','我是加按钮');
           //传递给兄弟
           this.$bus.$emit('xd','我爱兄弟')
       },
       minimychildren(){
           this.$emit('mini','我是减按钮');
           //传递给兄弟
           this.$bus.$emit('xd1','我爱兄弟1')
       }
  },
  created() {}
}
</script>

<style scoped>
.children{
    width: 600px;
    height: 300px;
    border: 1px solid #000;
    margin: 0 auto;
}
</style>
